package com.lq.listener;

import com.lq.constant.Contant;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * tomcat一启动就加载web.xml中的配置
 */
@WebListener
public class ContextListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        ServletContext servletContext = sce.getServletContext();
        Contant.SALT = servletContext.getInitParameter("SALT");
        Contant.BASE_URL_PATH = servletContext.getInitParameter("BASE_URL_PATH");
        Contant.BASE_PATH = servletContext.getInitParameter("BASE_PATH");
    }
}
